package cn.zzz.openplatform.common.selector;

import cn.zzz.openplatform.common.model.OpenApiCredentials;

import java.util.List;

/**
 * 轮询
 */
public class RoundRobinSelector implements CredentialSelector {
    private int index = 0;

    @Override
    public <T extends OpenApiCredentials> T select(List<T> credentials) {
        if (index >= credentials.size()) index = 0;  // 复位
        return credentials.get(index++);
    }
}
